import 'dart:typed_data';
import 'package:dart_des/dart_des.dart';
class Crypt{
  ///3DES加密
  static Uint8List DESEncrypt(List<int> key,List<int> data){
    List<int> encrypted;
    DES3 des = DES3(
      key: key,
      mode: DESMode.ECB,
      paddingType: DESPaddingType.PKCS7,
    );
    encrypted = des.encrypt(data);
    return Uint8List.fromList(encrypted);
  }
  ///3DES解密
  static Uint8List DESDecrypt(List<int> key,List<int> data){
    List<int> decrypted;
    DES3 des = DES3(
      key: key,
      mode: DESMode.ECB,
      paddingType: DESPaddingType.PKCS7,
    );
    decrypted = des.decrypt(data);
    return Uint8List.fromList(decrypted);
  }
}